package com.cloudlead.common.lang.api;

import com.cloudlead.common.lang.annotation.Label;

import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.HashMap;
import java.util.Map;

@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
@Label("请求")
public class SimpleActionRequest extends AbstractActionRequest {
    /**
     *
     */
    private static final long serialVersionUID = -6560404493577355579L;
    @NotNull
    @Label("请求内容")
    protected Map<String, Object> content;

    public SimpleActionRequest() {
        super();
    }

    public Map<String, Object> getContent() {
        return content;
    }

    public void setContent(Map<String, Object> content) {
        this.content = content;
    }

    public void addContent(String key, Object value) {
        if (null == content) {
            content = new HashMap<>();
        }
        content.put(key, value);
    }

    @Override
    public String toString() {
        return "SimpleActionRequest {" +
                "content=" + content +
                ",requestId=" + requestId + ", timeout="
                + timeout + ", cancel=" + cancel + ", accessToken="
                + accessToken +
                '}';
    }
}
